//
//  TelTableCell.m
//  EcmDoctor
//
//  Created by 张进 on 15/7/13.
//  Copyright (c) 2015年 张进. All rights reserved.
//

#import "TelTableCell.h"
#import <UIImageView+AFNetworking.h>
#import "NetWorkUtil.h"

@implementation TelTableCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setTelModel:(TelModel *)telModel {
    [self.headImage setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", [NetWorkUtil getImagesBaseUrl], telModel.icon_Url]] placeholderImage:[UIImage imageNamed:@"icon"]];
    
    
    UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", [NetWorkUtil getImagesBaseUrl], telModel.icon_Url]]]];
    NSData * imageData = UIImageJPEGRepresentation(image,1);
    
    long length = [imageData length]/1024/7;
    
    NSLog(@"------------////////%ld/////////    %@", length, [NSString stringWithFormat:@"%@%@", [NetWorkUtil getImagesBaseUrl], telModel.icon_Url]);
    
    self.nameLabel.text = telModel.name;
    self.ageLabel.text = [telModel.age stringValue];
    self.sexLabel.text = telModel.sex;
    self.msgLabel.text = telModel.content;
    if ([telModel.info_state isEqualToString:@"1"]) {
        self.isRead.alpha = 0;
    }
}

@end
